package com.xff.bean;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

public class MyBeanPostProcessor implements BeanPostProcessor {

    /*
     * @Description:  在每一个对象的初始化前面执行
     * @param bean  表示创建的具体对象
     * @param beanName 表示bean的id属性
     * @return: {@link java.lang.Object}
     * @author: xff
     * @Date: 2021/10/4
     */
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("postProcessBeforeInitialization:"+beanName);
        return bean;
    }

    /*
     * @Description: 在每一个对象的初始化后面执行
     * @param bean
 * @param beanName
     * @return: {@link java.lang.Object}
     * @author: xff
     * @Date: 2021/10/4
     */
    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("postProcessAfterInitialization:"+beanName);
        return bean;
    }
}
